package cn.nfwx.tv.down.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.hdl.m3u8.bean.M3U8;

public class DownloadInfo implements Parcelable {
    private String program_name;
    private String time;
    private String m3u8Url;
    private String basePath;
    private String m3u8Path;
    private M3U8 m3U8;
    private String action; // 广播接受者的各种行为


    public DownloadInfo(String program_name, String time, String m3u8Url, String basePath, String m3u8Path, M3U8 m3U8, String action) {
        this.program_name = program_name;
        this.time = time;
        this.m3u8Url = m3u8Url;
        this.basePath = basePath;
        this.m3u8Path = m3u8Path;
        this.m3U8 = m3U8;
        this.action = action;
    }

    public DownloadInfo(String program_name, String time, String m3u8Url, String basePath, String m3u8Path, String action) {
        this.program_name = program_name;
        this.time = time;
        this.m3u8Url = m3u8Url;
        this.basePath = basePath;
        this.m3u8Path = m3u8Path;
        this.action = action;
    }

    protected DownloadInfo(Parcel in) {
        program_name = in.readString();
        time = in.readString();
        m3u8Url = in.readString();
        basePath = in.readString();
        m3u8Path = in.readString();
        m3U8 = in.readParcelable(M3U8.class.getClassLoader());
        action = in.readString();
    }

    public static final Creator<DownloadInfo> CREATOR = new Creator<DownloadInfo>() {
        @Override
        public DownloadInfo createFromParcel(Parcel in) {
            return new DownloadInfo(in);
        }

        @Override
        public DownloadInfo[] newArray(int size) {
            return new DownloadInfo[size];
        }
    };

    public String getM3u8Url() {
        return m3u8Url;
    }

    public void setM3u8Url(String m3u8Url) {
        this.m3u8Url = m3u8Url;
    }

    public M3U8 getM3U8() {
        return m3U8;
    }

    public void setM3U8(M3U8 m3U8) {
        this.m3U8 = m3U8;
    }

    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public String getProgram_name() {
        return program_name;
    }

    public void setProgram_name(String program_name) {
        this.program_name = program_name;
    }

    public String getTime() {
        return time;
    }

    public void setTime(String time) {
        this.time = time;
    }

    public String getBasePath() {
        return basePath;
    }

    public void setBasePath(String basePath) {
        this.basePath = basePath;
    }

    public String getM3u8Path() {
        return m3u8Path;
    }

    public void setM3u8Path(String m3u8Path) {
        this.m3u8Path = m3u8Path;
    }

    @Override
    public String toString() {
        return "DownloadInfo{" +
                "m3u8Url=" + m3u8Url +
                ", m3U8=" + m3U8 +
                ", action='" + action + '\'' +
                '}';
    }

    public String getUniqueId() {
        return m3u8Url;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(program_name);
        dest.writeString(time);
        dest.writeString(m3u8Url);
        dest.writeString(basePath);
        dest.writeString(m3u8Path);
        dest.writeParcelable(m3U8, flags);
        dest.writeString(action);
    }
}
